package com.hpf.springcloud.handle;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.hpf.commons.utils.CommonResult;

/**
 * @description: 配置限流异常返回自定义
 * @datetime: 2020/10/31 18:12
 * @author: huangpengfei
 */
public class MyFlowExceptionHandler {

    /**
     * 必须是static方法，必须有BlockException类
     * @return
     */
    public static CommonResult handleExceptionUrl(BlockException e){
        return new CommonResult(500,"by Url fail","you are unlucky");
    }
    /**
     * 必须是static方法
     * @return
     */
    public static CommonResult handleExceptionResource(BlockException e){
        return new CommonResult(500,"by Resource fail","you are unlucky");
    }
}
